/*
这里封装基础请求
*/

import Axios from 'axios'
// import Cookie from 'js-cookie'

// const axiosInstance = Axios.create({
//   baseURL: '/api',
//   timeout: 8000
// })

Axios.defaults.baseURL = '/api'
Axios.defaults.timeout = 8000
// 响应拦截器
Axios.interceptors.response.use((config) => {
  const result = config.data
  if (result.status === 0) {
    // 响应成功
    return result.data
  } else if (result.status === 10) {
    //   跳转至登录页面
    window.location.href = '/#/login'
  } else {
    alert(result.msg)
  }
})

export default Axios
